#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import print_function, unicode_literals
import colorama
import msvcrt
import os
import sys

reload(sys)
sys.setdefaultencoding('utf-8')
colorama.init(autoreset=True)

ENTER = 13
ESC = 27
BACKSPACE = 8
DEL = 83
BEFORE_ARROW = 224
UP = 72
RIGHT = 77
DOWN = 80
LEFT = 75
F1 = 59
F2 = 60
F3 = 61
F4 = 62
F5 = 63
F6 = 64
F7 = 65
F8 = 66
F9 = 67
F10 = 68
F11 = 133
F12 = 134
ZERO = 48
ONE = 49
TWO = 50
THREE = 51
FOUR = 52
FIVE = 53
SIX = 54
SEVEN = 55
EIGHT = 56
NINE = 57
A = 97
B = 98
C = 99
Z = 122


def getch():
    c = ord(msvcrt.getch())
    # print("c1={}".format(c))
    if c == BEFORE_ARROW or c == 0:
        c = ord(msvcrt.getch())
        # print("c2={}".format(c))
    return c


def test_key_value():
    while 1:
        c = msvcrt.getch()
        print(ord(c))
        if ord(c) == ENTER:
            break
